﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyERP_DAL
{
    /// <summary>
    /// 异常信息管理数据访问类
    /// </summary>
    public abstract class B_Message_DAL
    {
        #region 获取异常信息文本类
        /// <summary>
        /// 获取异常信息文本类
        /// </summary>
        /// <param name="msg_cd">异常信息编码</param>
        /// <returns>异常信息文本</returns>
        public static string Get_Message(string msg_cd)
        {
            //sql语句
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat($"SELECT dbo.Get_Message('{msg_cd}') AS msg_text;");

            SqlDataReader dr = DbHelperSQL.ExecuteReader(sb.ToString());

            return dr.Read() ? dr["msg_text"].ToString() : null;

            //if (dr.Read())
            //{
            //    return dr["msg_text"].ToString();
            //}
            //return null;
        } 
        #endregion
    }
}
